<?php

namespace app\index\model;

use think\Model;
use traits\model\SoftDelete;

class Infomation extends Model
{
    use SoftDelete;
    protected $deleteTime = 'deletetime';
    protected $hidden = ['deletetime', 'updatetime', 'weigh', 'onlineswitch'];

    public function getCreateTimeAttr($value)
    {
        return $value ? date('Y-m-d', $value) : '';
    }

    public function getImageAttr($value)
    {
        return $value ? request()->domain().$value : '';
    }

    public static function lists($size = 20)
    {
        return self::where('onlineswitch', '>', 0)->order('weigh desc')->paginate($size);
    }
}
